﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using ELMWCFServiceClass.ELMWCF;

namespace ELMApplication.Common.UC
{
    public partial class MessageOutFormUC : UserControl
    {
        public MessageOutFormUC()
        {
            InitializeComponent();
        }
        public void UploadAtt(Guid guid,int detailid)
        {
            upatt.UploadAttachment(guid, detailid);
        }
        public event EventHandler HummanSelected;
        private void AutoCompleteBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count == 1)
            {
                Human hm = (Human)e.AddedItems[0];
                AutoCompleteBox ob = (AutoCompleteBox)sender;
                ob.SelectedItem = hm;
               Dataflow df=  (Dataflow)this.DataContext;
                df.ReceiveUser =(Human)ob.SelectedItem;
                this.DataContext = df;
                if (HummanSelected != null)
                {
                    HummanSelected.Invoke(this.DataContext, EventArgs.Empty);
                }
                
                
            }
        }
    }
}
